﻿@{
    ViewBag.Title = "店铺管理";
    ViewBag.PathToBtn = "/Shops/Create";
    ViewBag.TextBtn = "添加店铺";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div class="row">
    <div class="col-lg-12">
        
        <div class="panel panel-default">
            <div class="panel-heading">
                店铺列表
           
            </div>
            <div class="panel-body">
                <div class="dataTable_wrapper">
                    <table width="100%" class="table table-striped table-bordered table-hover" id="dataTables-example">
                        <thead>
                            <tr>
                                <th>名称</th>
                                <th>法人</th>
                                <th>法人联系电话</th>
                                <th>店铺地址</th>
                                <th>是否激活</th>
                                <th>店铺账号</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>                           
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

@section javascript{
    <script src="/Content/admin/dist/js/pagingHelper.js"> </script>
<script>
    $(function () {

        var isCreate = '@ViewBag.IsCreate';
        if (isCreate == 0) {
            $(".page-header").html(String.caller);
        }
    })
</script>
    <script type="text/javascript">
        var dataParams = {};
        var serverProcessPath = "/Shops/Listing";
        var showColumns = [
            { data: "Name" },
            { data: "LegalPerson" },
            { data: "LegalPersonMobile" },
            { data: "Address" },
            { data: "IsActive" },
            { data: "ShopMagAccount" },
            { data: "Action" }
        ];
        pagingHelper.Paging(serverProcessPath, dataParams, showColumns);

        function charge(id) {
            document.location.href = '/Shops/Charge/' + id;
        }

        function updateData(id) {
            document.location.href = '/Shops/Update/' + id;
        }

        function deleteData(id) {
            alertify
                .okBtn("确定")
                .cancelBtn("取消")
                .confirm("确定要删除该数据吗？", function () {
                    $.ajax({
                        type: 'post',
                        async: false,
                        url: '/Shops/Delete',
                        data: { doIds: id },
                        success: function (result) {
                            if (result) {
                                alertify.success("数据删除成功");
                                pagingHelper.reload();
                            } else {
                                alertify.error("数据删除失败");
                            }
                        }
                    });
                });
        }
    </script>
}